<?php
require_once('conexion_db.php');
require_once('auxiliares.php');
require_once('smarty/libs/Smarty.class.php');
require_once('seguridad.php');

$id_usuario = $_SESSION['id_user'];

$fields = array(
        
	"status",
	"nombre",
	"apellido",
	"invitadopor",
	"acompanante",
	"cant_acompanantes",
	"categoria",
	"direccion",
	"distrito",
	"telefono",
	"email",
	"mesa",
	"comentario",
	"confirmado"
);
$v = array();
foreach($fields as $f){
	$v[] = isset($_POST[$f]) ? "'" . mysql_real_escape_string( $_POST[$f]) . "'" : "''"; 
}

$campos = implode(",",$fields);

$values = implode(",",$v);

$insert = "INSERT INTO invitados(id_usuario, $campos) VALUES('$id_usuario', $values)";

mysql_query( $insert ) or die( mysql_error() );

# Template smarty
$oTpl = createObjSmarty();
$oTpl->display('tpl/agregarinvitado_grabar.html')
?>
